Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xSQLServerMaxDop: Added Cluster Aware code #901

Merged
merged 3 commits into from
Nov 8, 2017

Conversation

PaulFeaser
Copy link
Contributor

@PaulFeaser PaulFeaser commented Nov 7, 2017

Pull Request (PR) description
Made the resource cluster aware. When ProcessOnlyOnActiveNode is specified, the resource will only determine if a change is needed if the target node is the active host of the SQL Server instance

This Pull Request (PR) fixes the following issues:
Fixes #882

Task List:

  • Change details added to Unreleased section of CHANGELOG.md?
  • Added/updated documentation, comment-based help and descriptions in .schema.mof files where appropriate?
  • Examples appropriately updated?
  • New/changed code adheres to Style Guidelines?
  • Unit and (optional) Integration tests created/updated where possible?

This change is Reviewable

@johlju johlju changed the title Added Cluster Aware code per issue #882 xSQLServerMaxDop: Added Cluster Aware code Nov 7, 2017
@johlju johlju added the needs review The pull request needs a code review. label Nov 7, 2017
@codecov-io
Copy link

codecov-io commented Nov 7, 2017

Codecov Report

Merging #901 into dev will increase coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff          @@
##            dev   #901    +/-   ##
====================================
+ Coverage    96%    96%   +<1%     
====================================
  Files        32     32            
  Lines      3508   3513     +5     
====================================
+ Hits       3388   3393     +5     
  Misses      120    120

@johlju
Copy link
Member

johlju commented Nov 7, 2017

Thanks for sending this in! Great work on this one! 😄 Just minor review comments.


Reviewed 6 of 6 files at r1.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.psm1, line 238 at r1 (raw file):

$script:localizedData.NotActiveClusterNode

This resource has not yet been localized so we can't use this method (there are no localized string file). We have to hard code the string.

Like here:

https://github.com/PowerShell/xSQLServer/blob/1eddecbc424aec7b5c77eec70309cc8f88e10c7b/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1#L625


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 358 at r1 (raw file):

This is used with -TestCases parameter (Or I'm I wrong?). So maybe we need to set this the correct value if we are not using test cases? See below for example. But you could just hard code the correct value into the string if you don't want to use test cases.

https://github.com/PowerShell/xSQLServer/blob/1eddecbc424aec7b5c77eec70309cc8f88e10c7b/Tests/Unit/MSFT_xSQLServerAlwaysOnAvailabilityGroup.Tests.ps1#L1362-L1371


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 372 at r1 (raw file):

                }

                It 'Should be "true" when ProcessOnlyOnActiveNode is <mockProcessOnlyOnActiveNodeOriginal>.' {

Same as previous comment.


Comments from Reviewable

@johlju johlju added waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed needs review The pull request needs a code review. labels Nov 7, 2017
@PaulFeaser
Copy link
Contributor Author

Review status: 4 of 6 files reviewed at latest revision, 3 unresolved discussions.


DSCResources/MSFT_xSQLServerMaxDop/MSFT_xSQLServerMaxDop.psm1, line 238 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

$script:localizedData.NotActiveClusterNode

This resource has not yet been localized so we can't use this method (there are no localized string file). We have to hard code the string.

Like here:

https://github.com/PowerShell/xSQLServer/blob/1eddecbc424aec7b5c77eec70309cc8f88e10c7b/DSCResources/MSFT_xSQLServerAlwaysOnAvailabilityGroup/MSFT_xSQLServerAlwaysOnAvailabilityGroup.psm1#L625

Done.


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 358 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

This is used with -TestCases parameter (Or I'm I wrong?). So maybe we need to set this the correct value if we are not using test cases? See below for example. But you could just hard code the correct value into the string if you don't want to use test cases.

https://github.com/PowerShell/xSQLServer/blob/1eddecbc424aec7b5c77eec70309cc8f88e10c7b/Tests/Unit/MSFT_xSQLServerAlwaysOnAvailabilityGroup.Tests.ps1#L1362-L1371

I changed it so let me know if it is more what you were thinking.


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 372 at r1 (raw file):

I changed it so let me know if it is more what you were thinking.


Comments from Reviewable

@johlju johlju added needs review The pull request needs a code review. and removed waiting for author response The pull request is waiting for the author to respond to comments in the pull request. labels Nov 8, 2017
@johlju
Copy link
Member

johlju commented Nov 8, 2017

Reviewed 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 306 at r2 (raw file):

'When the system is not in the desired state and Ensure is set to absent and ProcessOnlyOnActiveNode is set to true'

This test actually mimics the previous test, that it should actually fail (return $false) because MaxDop has the wrong value (see It-block description in previous test), but because ProcessOnlyOnActiveNode is set to $true in this test, the test correctly returns $true. Maybe we should change the description here, or in the below It-block, to make that more clear?


Comments from Reviewable

@johlju johlju added waiting for author response The pull request is waiting for the author to respond to comments in the pull request. and removed needs review The pull request needs a code review. labels Nov 8, 2017
@PaulFeaser
Copy link
Contributor Author

Review status: 5 of 6 files reviewed at latest revision, 1 unresolved discussion.


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 306 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

'When the system is not in the desired state and Ensure is set to absent and ProcessOnlyOnActiveNode is set to true'

This test actually mimics the previous test, that it should actually fail (return $false) because MaxDop has the wrong value (see It-block description in previous test), but because ProcessOnlyOnActiveNode is set to $true in this test, the test correctly returns $true. Maybe we should change the description here, or in the below It-block, to make that more clear?

I changed the description and the It-Block verbiage


Comments from Reviewable

@PaulFeaser
Copy link
Contributor Author

Review status: 5 of 6 files reviewed at latest revision, 1 unresolved discussion.


Tests/Unit/MSFT_xSQLServerMaxDop.Tests.ps1, line 306 at r2 (raw file):

Previously, PaulFeaser (Paul Feaser) wrote…

I changed the description and the It-Block verbiage

Done.


Comments from Reviewable

@johlju johlju added needs review The pull request needs a code review. and removed waiting for author response The pull request is waiting for the author to respond to comments in the pull request. labels Nov 8, 2017
@johlju
Copy link
Member

johlju commented Nov 8, 2017

:lgtm:

Tests looks good. Thanks! Awesome work! 😄


Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@johlju johlju merged commit c10cb63 into dsccommunity:dev Nov 8, 2017
@vors vors removed the needs review The pull request needs a code review. label Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xSQLServerMaxDop: Should Be Cluster Aware
4 participants